Clean Code Principles And Patterns by Petri Silen
Author:Petri Silen
Language: eng
Format: epub
Figure 5.55from Message import Message class MessageBuffer: def write_if_buf_not_full(self, message: Message) -> bool: message_was_written = False buffer_is_not_full = len(self.__messages) < self.__max_length if buffer_is_not_full: self.__messages.append(message) message_was_written = True return message_was_written
5.4.5: Extract Named Constant or Enumerated Type
If you encounter a magic number in your code, you should introduce either a named constant or an enumerated type (enum) for that value. In the below example, we are returning two magic numbers, 0 and 1:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12405)
Hello! Python by Anthony Briggs(9755)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9646)
The Mikado Method by Ola Ellnestam Daniel Brolund(9643)
Dependency Injection in .NET by Mark Seemann(9172)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8153)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7657)
Grails in Action by Glen Smith Peter Ledbrook(7572)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7401)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6334)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6282)
Microservices with Go by Alexander Shuiskov(6088)
Practical Design Patterns for Java Developers by Miroslav Wengner(6007)
Test Automation Engineering Handbook by Manikandan Sambamurthy(5975)
Angular Projects - Third Edition by Aristeidis Bampakos(5321)
Kotlin in Action by Dmitry Jemerov(4921)
The Art of Crafting User Stories by The Art of Crafting User Stories(4897)
NetSuite for Consultants - Second Edition by Peter Ries(4861)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(4662)
